<?php
declare (strict_types = 1);

namespace app\api\validate\v1;

use think\Validate;

class SamValidate extends Validate
{
    /**
     * @User: 刘海龙
     * @Date: 2021/11/12
     * @Time: 14:26
     * @return string[]
     * 验证条件
     */
    public static function rules($id){
        $str = '';
        if (0 !== $id) {
            $str = ',' . $id;
        }
        return [
            'title' => 'require|max:20|unique:project_sample,title'. $str,
        ];
    }

    /**
     * @return array
     * 错误信息
     */
    public static function msg()
    {
        return [
            'title.require' => '样本点名称不能为空',
            'title.unique'=>'样本点名称已存在',
            'title.max' =>'样本点名称字符长度不能超过20'
        ];

    }
}
